<?php

// parse request
$uriInfo = explode('?', urldecode($_SERVER['REQUEST_URI']));
$uri = $uriInfo[0];


if($uri == '/' or $uri == 'index.html'){
    $_GET['module'] = 'default';
    $_GET['action'] = 'index';

    echo 'index';

} else if(preg_match('#^/flash/(\w+)/index_(\d+)\.html$#', $uri, $match) === 1){
    $cate = $match[1];
    $page = intval($match[2]);

    $_GET['module'] = 'default';
    $_GET['action'] = 'category';
    $_GET['cate']   = $cate;
    $_GET['page']   = $page;
    
    echo 'cate ' . $cate . ' ' . $page;
} else if(preg_match('#^/flash/(\w+)(/index\.html|/)$#', $uri, $match) === 1){
    $cate = $match[1];
    $page = 1;

    $_GET['module'] = 'default';
    $_GET['action'] = 'category';
    $_GET['cate']   = $cate;
    $_GET['page']   = $page;
    
    echo 'cate ' . $cate . ' ' . $page;

} else if(preg_match('#^/flash/(\w+)/(\d+)\.html$#', $uri, $match) === 1){
    $cate = $match[1]; 
    $id   = $match[2]; 

    $_GET['module'] = 'default';
    $_GET['action'] = 'gameid';
    $_GET['cate']   = $cate;
    $_GET['id']     = $id;

    echo 'game_id ' . $cate . ' ' . $id;

} else if(preg_match('#^/flash/(\w+)/(\w+)\.html$#', $uri, $match) === 1){
    $cate = $match[1]; 
    $alias = $match[2]; 

    $_GET['module'] = 'default';
    $_GET['action'] = 'gamealias';
    $_GET['cate']   = $cate;
    $_GET['alias']  = $alias;

    echo 'game_alias ' . $cate . ' ' . $alias;

}


